package boundary;

import java.util.Scanner;

public class Menu implements IMenu {

	private Scanner scanner;

	public Menu(Scanner scanner){
		this.scanner = scanner;
	}

	/* (non-Javadoc)
	 * @see src.IMenu#showMenu()
	 */
	@Override
	public int showMenu(){
		int choice;
			System.out.println("Følgende muligheder er til rådighed: "
					+ "\rTast 1 for Read Scale."
					+ "\rTast 2 for Tare Scale."
					+ "\rTast 3 for Zero Scale (nulstille)."
					+ "\rTast 4 for Display Text on Scale."
					+ "\rTast 5 for Display Weight on Scale."
					+ "\rTast 6 for RM20 kommando."
					+ "\rTast 7 for at afslutte.");

			String input = scanner.nextLine();
			switch (input) {
			case "1":
				choice = 1;
				break;
			case "2":
				choice = 2;
				break;
			case "3":
				choice = 3;
				break;
			case "4":
				choice = 4;
				break;
			case "5":
				choice = 5;
				break;
			case "6":
				choice = 6;
			break;
			case "7":
				choice = 7;
				break;
			default:
				choice = 0;
				break;
			}
			return choice;
	}
	
	@Override
	public void showMsg(String msg){
		System.out.println(msg);
	}

	@Override
	public String getText() {
		System.out.println("Indtast tekst: ");
		String text = scanner.nextLine();
		return text;
	}
}
